package com.sudo.common.component;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * author：为道日损 2020-06-21 14:49
 * webSite：https://www.sudo.ren
 */
// 该配置来自api模块下的application.yml
@Data
@Component
@ConfigurationProperties(prefix = "application")
public class ExtraProperties {

    @Resource
    @Setter(AccessLevel.NONE)
    @Getter(AccessLevel.NONE)
    private Environment environment;

    private String fileSpace;

    private String appName;

    private int registryPort;

    @PostConstruct
    public void init() {
        appName = environment.getProperty("spring.application.name");
    }
}
